﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Teigha.Core;

namespace Teigha.TD
{
	public class OdAveLight : OdGsLight
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdAveLight(IntPtr cPtr, bool cMemoryOwn) : base(TD_DbPINVOKE.OdAveLight_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdAveLight obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdAveLight()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdAveLight(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdAveLight cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdAveLight_cast(OdRxObject.getCPtr(pObj));
			OdAveLight result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdAveLight)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdAveLight)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdAveLight)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdAveLight_desc(), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdAveLight_isA(this.swigCPtr), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdAveLight_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdAveLight createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdAveLight_createObject();
			OdAveLight result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdAveLight)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdAveLight)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdAveLight)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdAveLight getLight(OdDbObjectId blockRefId)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdAveLight_getLight(OdDbObjectId.getCPtr(blockRefId));
			OdAveLight result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdAveLight)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdAveLight)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdAveLight)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static string getLightName(OdDbObjectId blockRefId)
		{
			string result = TD_DbPINVOKE.OdAveLight_getLightName(OdDbObjectId.getCPtr(blockRefId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdResult writeLight(OdDbDatabase pDb, OdDbHandle holderHandle, OdDbObjectId ownerId)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdAveLight_writeLight__SWIG_0(this.swigCPtr, OdDbDatabase.getCPtr(pDb), OdDbHandle.getCPtr(holderHandle), OdDbObjectId.getCPtr(ownerId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdResult writeLight(OdDbDatabase pDb, OdDbHandle holderHandle)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdAveLight_writeLight__SWIG_1(this.swigCPtr, OdDbDatabase.getCPtr(pDb), OdDbHandle.getCPtr(holderHandle));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdResult writeLight(OdDbDatabase pDb)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdAveLight_writeLight__SWIG_2(this.swigCPtr, OdDbDatabase.getCPtr(pDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdResult writeLight()
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdAveLight_writeLight__SWIG_3(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdGsLight.LightType type()
		{
			OdGsLight.LightType result = (OdGsLight.LightType)TD_DbPINVOKE.OdAveLight_type(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setType(OdGsLight.LightType type)
		{
			TD_DbPINVOKE.OdAveLight_setType(this.swigCPtr, (int)type);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public string name()
		{
			string result = TD_DbPINVOKE.OdAveLight_name(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setName(string name)
		{
			TD_DbPINVOKE.OdAveLight_setName(this.swigCPtr, name);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual double intensity()
		{
			double result = TD_DbPINVOKE.OdAveLight_intensity(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setIntensity(double intensity)
		{
			TD_DbPINVOKE.OdAveLight_setIntensity(this.swigCPtr, intensity);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new uint color()
		{
			uint result = TD_DbPINVOKE.OdAveLight_color(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setColor(uint color)
		{
			TD_DbPINVOKE.OdAveLight_setColor(this.swigCPtr, color);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdGePoint3d position()
		{
			OdGePoint3d result = new OdGePoint3d(TD_DbPINVOKE.OdAveLight_position(this.swigCPtr), true);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdGePoint3d target()
		{
			OdGePoint3d result = new OdGePoint3d(TD_DbPINVOKE.OdAveLight_target(this.swigCPtr), true);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdGeVector3d direction()
		{
			OdGeVector3d result = new OdGeVector3d(TD_DbPINVOKE.OdAveLight_direction(this.swigCPtr), true);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setPosition(OdGePoint3d position)
		{
			TD_DbPINVOKE.OdAveLight_setPosition(this.swigCPtr, OdGePoint3d.getCPtr(position));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setTarget(OdGePoint3d target)
		{
			TD_DbPINVOKE.OdAveLight_setTarget(this.swigCPtr, OdGePoint3d.getCPtr(target));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setDirection(OdGePoint3d fromPoint, OdGePoint3d toPoint)
		{
			TD_DbPINVOKE.OdAveLight_setDirection(this.swigCPtr, OdGePoint3d.getCPtr(fromPoint), OdGePoint3d.getCPtr(toPoint));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdGsLight.LightAttenuation attenuation()
		{
			OdGsLight.LightAttenuation result = (OdGsLight.LightAttenuation)TD_DbPINVOKE.OdAveLight_attenuation(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setAttenuation(OdGsLight.LightAttenuation attenuation)
		{
			TD_DbPINVOKE.OdAveLight_setAttenuation(this.swigCPtr, (int)attenuation);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public double innerConeAngle()
		{
			double result = TD_DbPINVOKE.OdAveLight_innerConeAngle(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public double outerConeAngle()
		{
			double result = TD_DbPINVOKE.OdAveLight_outerConeAngle(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setConeAngle(double innerConeAngle, double outerConeAngle)
		{
			TD_DbPINVOKE.OdAveLight_setConeAngle(this.swigCPtr, innerConeAngle, outerConeAngle);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isShadowOn()
		{
			bool result = TD_DbPINVOKE.OdAveLight_isShadowOn(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setShadowOn(bool shadowOn)
		{
			TD_DbPINVOKE.OdAveLight_setShadowOn(this.swigCPtr, shadowOn);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isShadowVolumes()
		{
			bool result = TD_DbPINVOKE.OdAveLight_isShadowVolumes(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setShadowVolumes(bool arg0)
		{
			TD_DbPINVOKE.OdAveLight_setShadowVolumes(this.swigCPtr, arg0);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public short shadowMapSize()
		{
			short result = TD_DbPINVOKE.OdAveLight_shadowMapSize__SWIG_0(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void shadowMapSize(short mapSize)
		{
			TD_DbPINVOKE.OdAveLight_shadowMapSize__SWIG_1(this.swigCPtr, mapSize);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public double shadowSoftness()
		{
			double result = TD_DbPINVOKE.OdAveLight_shadowSoftness(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setShadowSoftness(double shadowSoftness)
		{
			TD_DbPINVOKE.OdAveLight_setShadowSoftness(this.swigCPtr, shadowSoftness);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void shadowBoundingObjects(OdDbObjectIdArray objectIds)
		{
			TD_DbPINVOKE.OdAveLight_shadowBoundingObjects(this.swigCPtr, OdDbObjectIdArray.getCPtr(objectIds));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setShadowBoundingObjects(OdDbObjectIdArray objectIds)
		{
			TD_DbPINVOKE.OdAveLight_setShadowBoundingObjects(this.swigCPtr, OdDbObjectIdArray.getCPtr(objectIds));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void addShadowBoundingObject(OdDbObjectId objectId)
		{
			TD_DbPINVOKE.OdAveLight_addShadowBoundingObject(this.swigCPtr, OdDbObjectId.getCPtr(objectId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdDbObjectId holderId()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr cPtr = TD_DbPINVOKE.OdAveLight_holderId(this.swigCPtr);
			OdDbObjectId result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject(new OdDbObjectId(cPtr, true));
				result = new OdDbObjectId(cPtr, false);
			}
			else
			{
				result = new OdDbObjectId(cPtr, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
